<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>

<c:set var="context"
	value="${pageContext.request.servletContext.contextPath}" />
<tiles:importAttribute name="type" />
<tiles:importAttribute name="courses" />
<tiles:importAttribute name="ocourses" />
<tiles:importAttribute name="user" />

<ul id="horizontal_menu">
	<c:choose>
		<c:when test="${type == 1}">
			<li><a href="${context}/portal/" class="drop">Home</a>
				<div class="dropdown">
					<div class="col">
						<ul class="greybox">
							<li><a href="${context}/portal"><i
									class="fa fa-home fa-2x"></i><span class="nav-text">Home</span>
							</a></li>
							<li><a href="${context}/portal/user/list"><i
									class="fa fa-users fa-2x"></i><span class="nav-text">Users</span>
							</a></li>
							<li><a href="${context}/portal/subject/list"><i
									class="fa fa-book fa-2x"></i><span class="nav-text">Subjects</span>
							</a></li>
							<li><a href="${context}/portal/course/list"><i
									class="fa fa-graduation-cap  fa-2x"></i><span class="nav-text">Courses</span></a></li>
							<li><a href="${context}/portal/account/edit"><i
									class="fa fa-user fa-2x"></i><span class="nav-text">Account</span>
							</a></li>
							<li><a href="${context}/portal/account/changepassword"><i
									class="fa fa-refresh fa-2x"></i><span class="nav-text">Change
										password</span> </a></li>
						</ul>
					</div>
				</div>
		</c:when>
		<c:when test="${type == 2}">
			<li><a href="${context}/lecturer/" class="drop">Home</a>
				<div class="dropdown">
					<div class="col">
						<ul class="greybox">
							<li><a href="${context}/lecturer/"><i
									class="fa fa-home fa-2x"></i><span class="nav-text">Home</span>
							</a></li>
							<li><a href="${context}/lecturer/account/edit"><i
									class="fa fa-user fa-2x"></i><span class="nav-text">Account</span>
							</a></li>
							<li><a href="${context}/lecturer/account/changepassword"><i
									class="fa fa-refresh fa-2x"></i><span class="nav-text">Change
										password</span> </a></li>
						</ul>
					</div>
				</div>
		</c:when>
		<c:otherwise>
			<li><a href="${context}/student/" class="drop">Home</a>
				<div class="dropdown">
					<div class="col">
						<ul class="greybox">
							<li><a href="${context}/student/"><i
									class="fa fa-home fa-2x"></i><span class="nav-text">Home</span>
							</a></li>
							<li><a href="${context}/student/course/list"><i
									class="fa fa-graduation-cap  fa-2x"></i><span class="nav-text">Courses</span></a></li>
							<li><a href="${context}/student/account/edit"><i
									class="fa fa-user fa-2x"></i><span class="nav-text">Account</span>
							</a></li>
							<li><a href="${context}/student/account/changepassword"><i
									class="fa fa-refresh fa-2x"></i><span class="nav-text">Change
										password</span> </a></li>
						</ul>
					</div>
				</div>
		</c:otherwise>
	</c:choose>


	<c:choose>
		<c:when test="${type == 1}">
			<c:forEach var="course" items="${courses}">
				<li><a
					href="${context}/portal/course/detail/${course.courseId}"><c:out
							value="${course.courseName}"></c:out></a></li>
			</c:forEach>
		</c:when>
		<c:when test="${type == 2}">
			<c:forEach var="course" items="${ocourses}">
				<li><a
					href="${context}/lecturer/${user.userId}/${course.openCourseId}/"
					class="drop"><c:out value="${course.openCourseId}"></c:out></a>
					<div class="dropdown">
						<div class="col">
							<ul class="greybox">
								<c:forEach var="subject" items="${course.listSubject}">
									<li><a
										href="${context}/lecturer/${user.userId}/${course.openCourseId}/${subject.subjectId}/"><i
											class="fa fa-book fa-2x"></i><span class="nav-text">${subject.subjectName}</span></a></li>
								</c:forEach>
							</ul>
						</div>
					</div></li>
			</c:forEach>
		</c:when>
		<c:otherwise>
			<c:forEach var="course" items="${ocourses}">
				<li><a href="${context}/student/${user.userId}/${course.openCourseId}/"
					class="drop"><c:out value="${course.openCourseId}"></c:out></a>
					<div class="dropdown">
						<div class="col">
							<ul class="greybox">
								<c:forEach var="subject" items="${course.listSubject}">
									<li><a
										href="${context}/student/${user.userId}/${course.openCourseId}/${subject.subjectId}/"><i
											class="fa fa-book fa-2x"></i><span class="nav-text">${subject.subjectName}</span></a></li>
								</c:forEach>
							</ul>
						</div>
					</div></li>
			</c:forEach>
		</c:otherwise>
	</c:choose>
	<li class="menu_right" style="margin-top: 0px;"><a
		href="${context}/logout"> <i class="fa fa-power-off"
			style="width: 30px;"></i> <span class="nav-text" style="width: 50px;">
				Logout </span>
	</a></li>
</ul>
